#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>


MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    //给菜单下拉项设置快捷键
    QMenuBar* menuBar=new QMenuBar();
    this->setMenuBar(menuBar);
    QMenu* menu1=new QMenu("文件(&F)");
    QMenu* menu2=new QMenu("关于(&A)");
    menuBar->addMenu(menu1);
    menuBar->addMenu(menu2);

    QAction* action1=new QAction("活动1(&W)");
    QAction* action2=new QAction("活动2(&S)");
    menu1->addAction(action1);
    menu1->addAction(action2);

    connect(action1,&QAction::triggered,this,[]()
    {
        qDebug()<<"触发活动1!!";
    });
}

MainWindow::~MainWindow()
{
    delete ui;
}

